Optimal. Leaf size=117 \[ -\frac{2 a^2 \sqrt{c-d} (c+2 d) \tanh ^{-1}\left (\frac{\sqrt{c-d} \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{c+d}}\right )}{d^2 f (c+d)^{3/2}}-\frac{a^2 (c-d) \tan (e+f x)}{d f (c+d) (c+d \sec (e+f x))}+\frac{a^2 \tanh ^{-1}(\sin (e+f x))}{d^2 f} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.25679, antiderivative size = 231, normalized size of antiderivative = 1.97, number of steps used = 8, number of rules used = 8, integrand size = 31, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.258, Rules used = {3987, 98, 157, 63, 217, 203, 93, 205} \[ \frac{2 a^3 \sqrt{c-d} (c+2 d) \tan (e+f x) \tan ^{-1}\left (\frac{\sqrt{c+d} \sqrt{a \sec (e+f x)+a}}{\sqrt{c-d} \sqrt{a-a \sec (e+f x)}}\right )}{d^2 f (c+d)^{3/2} \sqrt{a-a \sec (e+f x)} \sqrt{a \sec (e+f x)+a}}-\frac{a^2 (c-d) \tan (e+f x)}{d f (c+d) (c+d \sec (e+f x))}+\frac{2 a^3 \tan (e+f x) \tan ^{-1}\left (\frac{\sqrt{a-a \sec (e+f x)}}{\sqrt{a (\sec (e+f x)+1)}}\right )}{d^2 f \sqrt{a-a \sec (e+f x)} \sqrt{a \sec (e+f x)+a}} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3987
Rule 98
Rule 157
Rule 63
Rule 217
Rule 203
Rule 93
Rule 205
Rubi steps
\begin{align*} \int \frac{\sec (e+f x) (a+a \sec (e+f x))^2}{(c+d \sec (e+f x))^2} \, dx &=-\frac{\left (a^2 \tan (e+f x)\right ) \operatorname{Subst}\left (\int \frac{(a+a x)^{3/2}}{\sqrt{a-a x} (c+d x)^2} \, dx,x,\sec (e+f x)\right )}{f \sqrt{a-a \sec (e+f x)} \sqrt{a+a \sec (e+f x)}}\\ &=-\frac{a^2 (c-d) \tan (e+f x)}{d (c+d) f (c+d \sec (e+f x))}+\frac{(a \tan (e+f x)) \operatorname{Subst}\left (\int \frac{-2 a^3 d-a^3 (c+d) x}{\sqrt{a-a x} \sqrt{a+a x} (c+d x)} \, dx,x,\sec (e+f x)\right )}{d (c+d) f \sqrt{a-a \sec (e+f x)} \sqrt{a+a \sec (e+f x)}}\\ &=-\frac{a^2 (c-d) \tan (e+f x)}{d (c+d) f (c+d \sec (e+f x))}-\frac{\left (a^4 \tan (e+f x)\right ) \operatorname{Subst}\left (\int \frac{1}{\sqrt{a-a x} \sqrt{a+a x}} \, dx,x,\sec (e+f x)\right )}{d^2 f \sqrt{a-a \sec (e+f x)} \sqrt{a+a \sec (e+f x)}}+\frac{\left (a \left (-2 a^3 d^2+a^3 c (c+d)\right ) \tan (e+f x)\right ) \operatorname{Subst}\left (\int \frac{1}{\sqrt{a-a x} \sqrt{a+a x} (c+d x)} \, dx,x,\sec (e+f x)\right )}{d^2 (c+d) f \sqrt{a-a \sec (e+f x)} \sqrt{a+a \sec (e+f x)}}\\ &=-\frac{a^2 (c-d) \tan (e+f x)}{d (c+d) f (c+d \sec (e+f x))}+\frac{\left (2 a^3 \tan (e+f x)\right ) \operatorname{Subst}\left (\int \frac{1}{\sqrt{2 a-x^2}} \, dx,x,\sqrt{a-a \sec (e+f x)}\right )}{d^2 f \sqrt{a-a \sec (e+f x)} \sqrt{a+a \sec (e+f x)}}+\frac{\left (2 a \left (-2 a^3 d^2+a^3 c (c+d)\right ) \tan (e+f x)\right ) \operatorname{Subst}\left (\int \frac{1}{a c-a d-(-a c-a d) x^2} \, dx,x,\frac{\sqrt{a+a \sec (e+f x)}}{\sqrt{a-a \sec (e+f x)}}\right )}{d^2 (c+d) f \sqrt{a-a \sec (e+f x)} \sqrt{a+a \sec (e+f x)}}\\ &=\frac{2 a^3 \sqrt{c-d} (c+2 d) \tan ^{-1}\left (\frac{\sqrt{c+d} \sqrt{a+a \sec (e+f x)}}{\sqrt{c-d} \sqrt{a-a \sec (e+f x)}}\right ) \tan (e+f x)}{d^2 (c+d)^{3/2} f \sqrt{a-a \sec (e+f x)} \sqrt{a+a \sec (e+f x)}}-\frac{a^2 (c-d) \tan (e+f x)}{d (c+d) f (c+d \sec (e+f x))}+\frac{\left (2 a^3 \tan (e+f x)\right ) \operatorname{Subst}\left (\int \frac{1}{1+x^2} \, dx,x,\frac{\sqrt{a-a \sec (e+f x)}}{\sqrt{a+a \sec (e+f x)}}\right )}{d^2 f \sqrt{a-a \sec (e+f x)} \sqrt{a+a \sec (e+f x)}}\\ &=\frac{2 a^3 \tan ^{-1}\left (\frac{\sqrt{a-a \sec (e+f x)}}{\sqrt{a+a \sec (e+f x)}}\right ) \tan (e+f x)}{d^2 f \sqrt{a-a \sec (e+f x)} \sqrt{a+a \sec (e+f x)}}+\frac{2 a^3 \sqrt{c-d} (c+2 d) \tan ^{-1}\left (\frac{\sqrt{c+d} \sqrt{a+a \sec (e+f x)}}{\sqrt{c-d} \sqrt{a-a \sec (e+f x)}}\right ) \tan (e+f x)}{d^2 (c+d)^{3/2} f \sqrt{a-a \sec (e+f x)} \sqrt{a+a \sec (e+f x)}}-\frac{a^2 (c-d) \tan (e+f x)}{d (c+d) f (c+d \sec (e+f x))}\\ \end{align*}
Mathematica [C] time = 1.47496, size = 312, normalized size = 2.67 \[ \frac{a^2 \sec ^4\left (\frac{1}{2} (e+f x)\right ) (\sec (e+f x)+1)^2 (c \cos (e+f x)+d) \left (\frac{2 \left (c^2+c d-2 d^2\right ) (\sin (e)+i \cos (e)) (c \cos (e+f x)+d) \tan ^{-1}\left (\frac{(\sin (e)+i \cos (e)) \left (\tan \left (\frac{f x}{2}\right ) (c \cos (e)-d)+c \sin (e)\right )}{\sqrt{c^2-d^2} \sqrt{(\cos (e)-i \sin (e))^2}}\right )}{(c+d) \sqrt{c^2-d^2} \sqrt{(\cos (e)-i \sin (e))^2}}+\frac{d (c-d) (d \sin (e)-c \sin (f x))}{c (c+d) \left (\cos \left (\frac{e}{2}\right )-\sin \left (\frac{e}{2}\right )\right ) \left (\sin \left (\frac{e}{2}\right )+\cos \left (\frac{e}{2}\right )\right )}-(c \cos (e+f x)+d) \log \left (\cos \left (\frac{1}{2} (e+f x)\right )-\sin \left (\frac{1}{2} (e+f x)\right )\right )+(c \cos (e+f x)+d) \log \left (\sin \left (\frac{1}{2} (e+f x)\right )+\cos \left (\frac{1}{2} (e+f x)\right )\right )\right )}{4 d^2 f (c+d \sec (e+f x))^2} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] time = 0.11, size = 330, normalized size = 2.8 \begin{align*}{\frac{{a}^{2}}{f{d}^{2}}\ln \left ( \tan \left ({\frac{fx}{2}}+{\frac{e}{2}} \right ) +1 \right ) }-{\frac{{a}^{2}}{f{d}^{2}}\ln \left ( \tan \left ({\frac{fx}{2}}+{\frac{e}{2}} \right ) -1 \right ) }+2\,{\frac{{a}^{2}c\tan \left ( 1/2\,fx+e/2 \right ) }{fd \left ( c+d \right ) \left ( \left ( \tan \left ( 1/2\,fx+e/2 \right ) \right ) ^{2}c- \left ( \tan \left ( 1/2\,fx+e/2 \right ) \right ) ^{2}d-c-d \right ) }}-2\,{\frac{{a}^{2}{c}^{2}}{f{d}^{2} \left ( c+d \right ) \sqrt{ \left ( c+d \right ) \left ( c-d \right ) }}{\it Artanh} \left ({\frac{\tan \left ( 1/2\,fx+e/2 \right ) \left ( c-d \right ) }{\sqrt{ \left ( c+d \right ) \left ( c-d \right ) }}} \right ) }-2\,{\frac{{a}^{2}c}{fd \left ( c+d \right ) \sqrt{ \left ( c+d \right ) \left ( c-d \right ) }}{\it Artanh} \left ({\frac{\tan \left ( 1/2\,fx+e/2 \right ) \left ( c-d \right ) }{\sqrt{ \left ( c+d \right ) \left ( c-d \right ) }}} \right ) }-2\,{\frac{{a}^{2}\tan \left ( 1/2\,fx+e/2 \right ) }{f \left ( c+d \right ) \left ( \left ( \tan \left ( 1/2\,fx+e/2 \right ) \right ) ^{2}c- \left ( \tan \left ( 1/2\,fx+e/2 \right ) \right ) ^{2}d-c-d \right ) }}+4\,{\frac{{a}^{2}}{f \left ( c+d \right ) \sqrt{ \left ( c+d \right ) \left ( c-d \right ) }}{\it Artanh} \left ({\frac{\tan \left ( 1/2\,fx+e/2 \right ) \left ( c-d \right ) }{\sqrt{ \left ( c+d \right ) \left ( c-d \right ) }}} \right ) } \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] time = 0.987852, size = 1289, normalized size = 11.02 \begin{align*} \left [\frac{{\left (a^{2} c d + 2 \, a^{2} d^{2} +{\left (a^{2} c^{2} + 2 \, a^{2} c d\right )} \cos \left (f x + e\right )\right )} \sqrt{\frac{c - d}{c + d}} \log \left (\frac{2 \, c d \cos \left (f x + e\right ) -{\left (c^{2} - 2 \, d^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \,{\left (c^{2} + c d +{\left (c d + d^{2}\right )} \cos \left (f x + e\right )\right )} \sqrt{\frac{c - d}{c + d}} \sin \left (f x + e\right ) + 2 \, c^{2} - d^{2}}{c^{2} \cos \left (f x + e\right )^{2} + 2 \, c d \cos \left (f x + e\right ) + d^{2}}\right ) +{\left (a^{2} c d + a^{2} d^{2} +{\left (a^{2} c^{2} + a^{2} c d\right )} \cos \left (f x + e\right )\right )} \log \left (\sin \left (f x + e\right ) + 1\right ) -{\left (a^{2} c d + a^{2} d^{2} +{\left (a^{2} c^{2} + a^{2} c d\right )} \cos \left (f x + e\right )\right )} \log \left (-\sin \left (f x + e\right ) + 1\right ) - 2 \,{\left (a^{2} c d - a^{2} d^{2}\right )} \sin \left (f x + e\right )}{2 \,{\left ({\left (c^{2} d^{2} + c d^{3}\right )} f \cos \left (f x + e\right ) +{\left (c d^{3} + d^{4}\right )} f\right )}}, -\frac{2 \,{\left (a^{2} c d + 2 \, a^{2} d^{2} +{\left (a^{2} c^{2} + 2 \, a^{2} c d\right )} \cos \left (f x + e\right )\right )} \sqrt{-\frac{c - d}{c + d}} \arctan \left (-\frac{{\left (d \cos \left (f x + e\right ) + c\right )} \sqrt{-\frac{c - d}{c + d}}}{{\left (c - d\right )} \sin \left (f x + e\right )}\right ) -{\left (a^{2} c d + a^{2} d^{2} +{\left (a^{2} c^{2} + a^{2} c d\right )} \cos \left (f x + e\right )\right )} \log \left (\sin \left (f x + e\right ) + 1\right ) +{\left (a^{2} c d + a^{2} d^{2} +{\left (a^{2} c^{2} + a^{2} c d\right )} \cos \left (f x + e\right )\right )} \log \left (-\sin \left (f x + e\right ) + 1\right ) + 2 \,{\left (a^{2} c d - a^{2} d^{2}\right )} \sin \left (f x + e\right )}{2 \,{\left ({\left (c^{2} d^{2} + c d^{3}\right )} f \cos \left (f x + e\right ) +{\left (c d^{3} + d^{4}\right )} f\right )}}\right ] \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F] time = 0., size = 0, normalized size = 0. \begin{align*} a^{2} \left (\int \frac{\sec{\left (e + f x \right )}}{c^{2} + 2 c d \sec{\left (e + f x \right )} + d^{2} \sec ^{2}{\left (e + f x \right )}}\, dx + \int \frac{2 \sec ^{2}{\left (e + f x \right )}}{c^{2} + 2 c d \sec{\left (e + f x \right )} + d^{2} \sec ^{2}{\left (e + f x \right )}}\, dx + \int \frac{\sec ^{3}{\left (e + f x \right )}}{c^{2} + 2 c d \sec{\left (e + f x \right )} + d^{2} \sec ^{2}{\left (e + f x \right )}}\, dx\right ) \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] time = 1.38316, size = 323, normalized size = 2.76 \begin{align*} \frac{\frac{a^{2} \log \left ({\left | \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + 1 \right |}\right )}{d^{2}} - \frac{a^{2} \log \left ({\left | \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - 1 \right |}\right )}{d^{2}} + \frac{2 \,{\left (a^{2} c^{2} + a^{2} c d - 2 \, a^{2} d^{2}\right )}{\left (\pi \left \lfloor \frac{f x + e}{2 \, \pi } + \frac{1}{2} \right \rfloor \mathrm{sgn}\left (2 \, c - 2 \, d\right ) + \arctan \left (\frac{c \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - d \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )}{\sqrt{-c^{2} + d^{2}}}\right )\right )}}{{\left (c d^{2} + d^{3}\right )} \sqrt{-c^{2} + d^{2}}} + \frac{2 \,{\left (a^{2} c \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - a^{2} d \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )\right )}}{{\left (c \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{2} - d \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{2} - c - d\right )}{\left (c d + d^{2}\right )}}}{f} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]